CreateIndex Method

           

Creates a new Index object (Microsoft Jet workspaces only).

Syntax

Set index = tabledef.CreateIndex (name)

The CreateIndex method syntax has these parts.

Part Description
index An object variable that represents the index you want to create.
tabledef An object variable that represents the TableDef object you want to use to create the new Index object.
name Optional. A Variant (String subtype) that uniquely names the new Index object. See the Name property for details on valid Index names.

Remarks

You can use the CreateIndex method to create a new Index object for a TableDef object. If you omit the optional name part when you use CreateIndex, you can use an appropriate assignment statement to set or reset the Name property before you append the new object to a collection. After you append the object, you may or may not be able to set its Name property, depending on the type of object that contains the Indexes collection. See the Name property topic for more details.

If name refers to an object that is already a member of the collection, a run-time error occurs when you use the Append method.

To remove an Index object from a collection, use the Delete method on the collection.